.class public Lcom/zuiapps/suite/utils/device/AirplaneModeUtil;
.super Ljava/lang/Object;
.source "AirplaneModeUtil.java"


# static fields
.field private static final COMMAND_FLIGHT_MODE_1:Ljava/lang/String; = "settings put global airplane_mode_on"

.field private static final COMMAND_FLIGHT_MODE_2:Ljava/lang/String; = "am broadcast -a android.intent.action.AIRPLANE_MODE --ez state"


# instance fields
.field private mContext:Landroid/content/Context;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 2
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 19
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 20
    iput-object p1, p0, Lcom/zuiapps/suite/utils/device/AirplaneModeUtil;->mContext:Landroid/content/Context;

    .line 21
    return-void
.end method


# virtual methods
.method public isFlightModeEnabled()Z
    .registers 7

    .prologue
    const/4 v1, 0x1

    const/4 v2, 0x0

    .line 93
    const/4 v0, 0x0

    .line 94
    .local v0, "mode":Z
    :try_start_3
    sget v3, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v4, 0x10

    if-le v3, v4, :cond_1c

    .line 96
    iget-object v3, p0, Lcom/zuiapps/suite/utils/device/AirplaneModeUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "airplane_mode_on"

    const/4 v5, 0x0

    invoke-static {v3, v4, v5}, Landroid/provider/Settings$Global;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v3

    if-ne v3, v1, :cond_1a

    move v0, v1

    .line 105
    .end local v0    # "mode":Z
    :goto_19
    return v0

    .restart local v0    # "mode":Z
    :cond_1a
    move v0, v2

    .line 96
    goto :goto_19

    .line 99
    :cond_1c
    iget-object v3, p0, Lcom/zuiapps/suite/utils/device/AirplaneModeUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    const-string v4, "airplane_mode_on"

    const/4 v5, 0x0

    invoke-static {v3, v4, v5}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
    :try_end_28
    .catch Ljava/lang/Throwable; {:try_start_3 .. :try_end_28} :catch_2f

    move-result v3

    if-ne v3, v1, :cond_2d

    move v0, v1

    :goto_2c
    goto :goto_19

    :cond_2d
    move v0, v2

    goto :goto_2c

    .line 102
    :catch_2f
    move-exception v1

    move v0, v2

    .line 105
    goto :goto_19
.end method

.method public setFlightMode()Landroid/content/Intent;
    .registers 11

    .prologue
    const/4 v6, 0x1

    const/4 v5, 0x0

    const/high16 v9, 0x10000000

    .line 33
    sget v4, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v7, 0x10

    if-le v4, v7, :cond_4a

    .line 51
    :try_start_a
    iget-object v4, p0, Lcom/zuiapps/suite/utils/device/AirplaneModeUtil;->mContext:Landroid/content/Context;

    invoke-static {v4}, Lcom/zuiapps/suite/utils/device/DeviceUtil;->isEmotionUI2(Landroid/content/Context;)Z

    move-result v4

    if-nez v4, :cond_18

    invoke-static {}, Lcom/zuiapps/suite/utils/device/DeviceUtil;->isSumsungCorePrime()Z
    :try_end_15
    .catch Landroid/content/ActivityNotFoundException; {:try_start_a .. :try_end_15} :catch_36

    move-result v4

    if-eqz v4, :cond_29

    .line 53
    :cond_18
    :try_start_18
    new-instance v2, Landroid/content/Intent;

    const-string v4, "android.settings.SETTINGS"

    invoke-direct {v2, v4}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 54
    .local v2, "intent":Landroid/content/Intent;
    const/high16 v4, 0x10000000

    invoke-virtual {v2, v4}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
    :try_end_24
    .catch Ljava/lang/Throwable; {:try_start_18 .. :try_end_24} :catch_25
    .catch Landroid/content/ActivityNotFoundException; {:try_start_18 .. :try_end_24} :catch_36

    .line 88
    .end local v2    # "intent":Landroid/content/Intent;
    :goto_24
    return-object v2

    .line 56
    :catch_25
    move-exception v3

    .line 57
    .local v3, "t":Ljava/lang/Throwable;
    :try_start_26
    invoke-virtual {v3}, Ljava/lang/Throwable;->printStackTrace()V

    .line 62
    .end local v3    # "t":Ljava/lang/Throwable;
    :cond_29
    new-instance v2, Landroid/content/Intent;

    const-string v4, "android.settings.AIRPLANE_MODE_SETTINGS"

    invoke-direct {v2, v4}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 63
    .restart local v2    # "intent":Landroid/content/Intent;
    const/high16 v4, 0x10000000

    invoke-virtual {v2, v4}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
    :try_end_35
    .catch Landroid/content/ActivityNotFoundException; {:try_start_26 .. :try_end_35} :catch_36

    goto :goto_24

    .line 65
    .end local v2    # "intent":Landroid/content/Intent;
    :catch_36
    move-exception v0

    .line 67
    .local v0, "e":Landroid/content/ActivityNotFoundException;
    :try_start_37
    new-instance v2, Landroid/content/Intent;

    const-string v4, "android.settings.SETTINGS"

    invoke-direct {v2, v4}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 68
    .restart local v2    # "intent":Landroid/content/Intent;
    const/high16 v4, 0x10000000

    invoke-virtual {v2, v4}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
    :try_end_43
    .catch Ljava/lang/Throwable; {:try_start_37 .. :try_end_43} :catch_44

    goto :goto_24

    .line 70
    .end local v2    # "intent":Landroid/content/Intent;
    :catch_44
    move-exception v3

    .line 71
    .restart local v3    # "t":Ljava/lang/Throwable;
    invoke-virtual {v3}, Ljava/lang/Throwable;->printStackTrace()V

    .line 88
    .end local v0    # "e":Landroid/content/ActivityNotFoundException;
    .end local v3    # "t":Ljava/lang/Throwable;
    :goto_48
    const/4 v2, 0x0

    goto :goto_24

    .line 80
    :cond_4a
    invoke-virtual {p0}, Lcom/zuiapps/suite/utils/device/AirplaneModeUtil;->isFlightModeEnabled()Z

    move-result v1

    .line 81
    .local v1, "enabled":Z
    iget-object v4, p0, Lcom/zuiapps/suite/utils/device/AirplaneModeUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v4}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v7

    const-string v8, "airplane_mode_on"

    if-eqz v1, :cond_73

    move v4, v5

    :goto_59
    invoke-static {v7, v8, v4}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    .line 82
    new-instance v2, Landroid/content/Intent;

    const-string v4, "android.intent.action.AIRPLANE_MODE"

    invoke-direct {v2, v4}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 83
    .restart local v2    # "intent":Landroid/content/Intent;
    invoke-virtual {v2, v9}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;

    .line 84
    const-string v4, "state"

    if-nez v1, :cond_75

    :goto_6a
    invoke-virtual {v2, v4, v6}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    .line 85
    iget-object v4, p0, Lcom/zuiapps/suite/utils/device/AirplaneModeUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v4, v2}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V

    goto :goto_48

    .end local v2    # "intent":Landroid/content/Intent;
    :cond_73
    move v4, v6

    .line 81
    goto :goto_59

    .restart local v2    # "intent":Landroid/content/Intent;
    :cond_75
    move v6, v5

    .line 84
    goto :goto_6a
.end method
